#ifndef __ming_fyp_shadows_VarPCF4_h__
#define __ming_fyp_shadows_VarPCF4_h__

//------------------------------------------------------------------------------
// header includes
#include "fyp/ShadowAlgorithm.h"
#include "fyp/core/String.h"

#include <vector>


//------------------------------------------------------------------------------
namespace ming
{
namespace fyp
{
namespace shadows
{
	//--------------------------------------------------------------------------
	class TVarPCF4 : public IShadowAlgorithm
	{
		friend class TVarPCF4Gui;

	public:
		//------------------------------
		// #cstor & #dstor
		TVarPCF4();
		virtual ~TVarPCF4();
		
		//------------------------------
		// external operations
		virtual void Init(TResourcePool *resPool, TGuiManager *guiMgr);

		virtual void RenderScene(
			render::IRenderer *renderer,
			TResourcePool *resPool,
			TObjectManager *objMgr);
		
		virtual void Final(TResourcePool *resPool);
		
		virtual void ChangeShadowMapSize(size_t sz);
		
		virtual const char* GetDescription();

	private:
		//------------------------------
		// internal attributes
		int mPendingShadowMapSize;
		bool mShadowMapParamDuty;
		std::vector<float> mReduceFactors;
		std::vector<int> mDilateCnts;
		int mCurrReduceFactor;
		float mDistanceFactor;

		//------------------------------
		// internal operations
		void CreateShadowMaps(TResourcePool *resPool);
		void RemoveShadowMaps(TResourcePool *resPool);

		void CreateShadowMap(
			TResourcePool *resPool,
			const TStr &name,
			size_t format,
			size_t size);

		void GenerateShadowMap(
			render::IRenderer *renderer,
			TResourcePool *resPool,
			TObjectManager *objMgr);

		void RenderSceneWithShadowMap(
			render::IRenderer *renderer,
			TResourcePool *resPool,
			TObjectManager *objMgr);
	};
	
	//--------------------------------------------------------------------------
}
}
}


#endif	//__ming_fyp_shadows_VarPCF4_h__